<?php
require_once ("db/db_connector.php");
require_once ("db/db_favorite.php");

// Database Access Begins ---------------------------------------- //
$con = get_db_con();

$id = $_POST['paradise_id'];
session_start();
$user_id = $_SESSION['user_id'];

if (is_favorite($id)) {
	delete_favorite($con, $id, $user_id);
} else {
	insert_favorite($con, $id, $user_id);
}
// error_log("HERERERERE");
// add_remove_favorite($id);
header("Location: paradise.php?id=$id");

close_db_con();
// Database Access Ends ------------------------------------------ //
